//
// Created by fanghr on 17-12-24.
//

#ifndef PROJECT_CAM_CAMERAMATRIX_H
#define PROJECT_CAM_CAMERAMATRIX_H

#include "../../include.h"

class cam_cameraInfo {
public:
    struct table_t {
        friend class boost::serialization::access;

        double cameraMatrix[3][3];
        double distCoeffsMatrix[1][5];

        template<class Archive>
        void serialize(Archive &ar, const unsigned int) {
            ar & cameraMatrix;
            ar & distCoeffsMatrix;
        }
    };

private:
    friend class boost::serialization::access;

    table_t table;

    template<class Archive>
    void serialize(Archive &ar, const unsigned int) {
        ar & table;
    }

public:
    cam_cameraInfo(cv::Mat a, cv::Mat b) {
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                table.cameraMatrix[i][j] = a.at<double>(i, j);
        for (int p = 0; p < 5; p++)
            table.distCoeffsMatrix[0][p] = b.at<double>(0, p);
    }

    table_t get() {
        return table;
    }
};


#endif //PROJECT_CAM_CAMERAMATRIX_H
